#ifndef LATEXCON_H_
#define LATEXCON_H_

#include "IConverter.h"
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#include <boost/signals2.hpp>

class HtmlReader
{
	public:
		HtmlReader(std::string theFile);
		~HtmlReader(void);

		boost::signals2::signal<char* (const unsigned char*,unsigned char*)> OnTextParsed;

		bool StartParsing();

		bool Save(std::string theOutput);

	private:
		htmlDocPtr myHtmlDoc;
		void postprocess(std::string theFile);
		void walk_tree(xmlNode *theNode);
};



class Latexcon : public PluginSystem::IConverter
{
	public:
		Latexcon(void);
		~Latexcon(void);

		virtual bool Open(PComunicator::PFileInfo &theFile);

		virtual std::wstring Read();

		virtual std::string Format();

		virtual std::string CreateHtml(std::string thePath); 

		virtual char* Version();

		virtual char* Autor();

	private:
		std::string myTmpDir;
		std::string myExe;
		std::string myTexFile;
		std::string myPath;
		std::string myHtml;
		std::wstring myContent;

		void make_html();
		
		char *parsed_text(const unsigned char *node,unsigned char *nodeValue);
};


#endif